package com.CampaignManager.server;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import com.google.appengine.api.datastore.Key;

@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class CityRelate {

	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	private Key id;
	public Key getId() {
		return this.id;
	}
	
	@Persistent
	private City city;	
	public City getCity() {
		return this.city;
	}
	public void setCity(City c) {
		this.city = c;
	}
	
	@Persistent
	private String otherCity;
	public String getOtherCity() {
		return otherCity;		
	}
	public void setOtherCity(String otherCity) {
		this.otherCity = otherCity;
	}
	
	@Persistent
	private Long value;
	public Long getValue() {
		if (value == null ) value = 0L;
		return value;
	}
	public void setValue(Long value) {
		this.value = value;
	}
	
	@Persistent
	private String ownerCity;
	public String getOwnerCity() {
		if (ownerCity == null) ownerCity = city.getName();
		return ownerCity;		
	}
	public void setOwnerCity(String ownerCity) {
		this.ownerCity = ownerCity;
	}
	
}
